To address the poor results of foreground extraction from dynamic background, a motion detection method based on deep auto-encoder networks was proposed. Firstly, background images without containing motion objects were subtracted from video frames using a three-layer deep auto-encoder network whose cost function contained background as variable. Then, another three-layer deep auto-encoder network was used to learn the subtracted background images which are obtained by constructed separating function. To achieve online motion detection through deep auto-encoder learning, an online learning method of deep auto-encoder network was also proposed. The weights of network were merged according to the sensitivity of cost function to process more video frames. From the experimental results, the proposed method obtains better motion detection accuracy by 6%, and lower false rate by 4.5% than Lus work (LU C, SHI J, JIA J. Online robust dictionary learning. Proceeding of the 2013 IEEE Conference on Computer Vision and Pattern Recognition, Piscataway: IEEE Press, 2013:415-422). This work also obtains better extraction results of background and foreground in real applications, and lays better basis for video analysis.